run

This function runs an executable program.

bool run(string filename, string command_line, bool wait_for_completion, bool background)

Parameters:
filename
The name of the executable file to run.
command_line
The command line parameters that should be given to the program.
wait_for_completion
A boolean (true or false) that specifies whether or not the function should wait for the new executable to finish running before returning.
background
A boolean (true or false) that specifies whether or not the new program should be run in the background, e.g. display no window.

Return value:
true on success, false on failure.

Remarks:
No command line parameters should be specified as part of the executable name. Instead, those should be given as the second parameter only.

This function works with both absolute and relative paths.

Example:
// Run notepad.exe and wait for it to close.

void main()
{
bool result=run("C:\\windows\\notepad.exe", "", true, false);
if(result==false)
{
alert("Error", "notepad.exe could not be run.");
exit();
}
alert("Goodbye", "Thank you for using notepad. Your satisfaction is not guaranteed.");
}